<script setup>
    import { nextTick, onMounted } from 'vue'

    const props = defineProps({
        publicityVideo: {
            type: Array,
            default: []
        }
    })

    let videoUrl = $ref(props.publicityVideo)

    let step = $ref(0)

    onMounted(() => {
        var elevideo = document.getElementById("video1")

        elevideo.addEventListener('ended', function () { //结束
            if(step + 1 >= videoUrl.length) step = 0
            else step = step+1
        }, false)
    })


</script>

<template>
    <div class="video-wrap">
        <video :src="videoUrl[step].url" id="video1" autoplay controls></video>
    </div>
</template>

<style lang="less" scoped>
    .video-wrap video{
        width: 100%;
        height: 230px;
        background: #000;
    }
</style>